package org.related.config;

import org.related.annotations.EnableTest;
import org.related.service.DemoProperties;
import org.related.service.DemoService;
import org.related.service.TestA;
import org.related.service.TestB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @Package org.releated.config
 * @PROJECT_NAME: question
 * @DESCRIPTION:
 * @USER: zhuchenglin
 * @DATE: 2022/3/1 10:31
 */
@Import({TestA.class, TestB.class, SelfImportSelector.class,
        SelfImportBeanDefinitionRegistrar.class})
@Configuration
@EnableTest
@EnableConfigurationProperties(DemoProperties.class)
public class ImportConfig {

    @Autowired
    private DemoProperties demoProperties;

    @Bean(name = "demo")
    public DemoService demoService() {
        return new DemoService(demoProperties.getSayWhat(), demoProperties.getToWho());
    }
}
